#!/usr/bin/env node

const fs=require('fs'),
      src=process.argv[2],
      dst=process.argv[3];

try{
  let srcStream=fs.createReadStream(src),
      dstStream=fs.createWriteStream(dst);

  srcStream.pipe(dstStream);
  dstStream.on('close',()=>{
    fs.chmodSync(dst,fs.statSync(src).mode);
  });
}catch(e){
  console.log(e.message);
  process.exit(6);
}

